package com.fqgj.xjd.user.client.enums;

/**
 * 授权采集类型枚举
 *
 * @author liuming
 * Created on 下午4:06 2019/6/27.
 */
public enum AuthCollectTypeEnum {

    FACEBOOK(1, "tongdun facebook", "103001"),
    OLA(2, "tongdun ola", "604003");

    private Integer type;
    private String desc;
    private String channelCode;

    AuthCollectTypeEnum(Integer type, String desc, String channelCode) {
        this.type = type;
        this.desc = desc;
        this.channelCode = channelCode;
    }

    public String getChannelCode() {
        return channelCode;
    }

    public AuthCollectTypeEnum setChannelCode(String channelCode) {
        this.channelCode = channelCode;
        return this;
    }

    public Integer getType() {
        return type;
    }

    public AuthCollectTypeEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public AuthCollectTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static AuthCollectTypeEnum getEnumByType(Integer type) {
        AuthCollectTypeEnum authCollectTypeEnum = null;
        for (AuthCollectTypeEnum enumObj : AuthCollectTypeEnum.values()) {
            if (enumObj.getType().equals(type)) {
                authCollectTypeEnum = enumObj;
                break;
            }
        }
        return authCollectTypeEnum;
    }

    public static AuthCollectTypeEnum getEnumByChannelCode(String channelCode) {
        AuthCollectTypeEnum authCollectTypeEnum = null;
        for (AuthCollectTypeEnum enumObj : AuthCollectTypeEnum.values()) {
            if (enumObj.getChannelCode().equals(channelCode)) {
                authCollectTypeEnum = enumObj;
                break;
            }
        }
        return authCollectTypeEnum;
    }
}
